$(function () {
	// 修改密码
	  $("#updatepass").on('click', function () {
	    var dialog = $("<div/>", {class: 'noflow'}).dialog({
	      title: "修改密码",
	      iconCls: 'fa fa-lock',
	      height:320,
	      width: 420,
	      href: '/change/password',
	      modal: true,
	      onClose: function () {
	        $(this).dialog("destroy");
	      },
	      onLoad: function () {
	        // 窗口表单加载成功时执行
	        form = $("#updatePassForm", this);
	      },
	      buttons: [{
	        iconCls: 'icon-save',
	        text: '确认修改',
	        handler: function () {
	          if (form.form('validate')) {
	            $.post("/change/password", form.serialize(), function (res) {
	              if (res.success) {
	                dialog.dialog('close');
	                location.replace('/logout');
	              } else {
	                $.messager.alert("系统提示", res.message);
	              }
	            })
	          }
	        }
	      }]
	  });
	  });
	/**
	 * 修改当前用资料
	 */
	  $("#userinfos").on('click', function () {
		    var dialog = $("<div/>", {class: 'noflow'}).dialog({
		      title: "保存",
		      iconCls: 'icon-save',
		      height:530,
		      width: 660,
		      href: '/change/userinfo',
		      modal: true,
		      onClose: function () {
		        $(this).dialog("destroy");
		      },
		     /* onLoad: function () {
		        // 窗口表单加载成功时执行
		        form = $("#userinfoForm", this);
		      },*/
		      buttons: [{
		        iconCls: 'icon-save',
		        text: '保存',
		        handler : function() {
					$("#userinfoForm").form('submit', {
						url : 'change/info',
						data : $("#userinfoForm").serialize(),
						success : function(success) {
							if (success) {
								// 关闭窗口
								dialog.dialog("close");
								location.replace('/zhujiemian');
								$.messager.alert("提示", "上传成功！");
							} else {
								$.messager.alert("提示", success.message);
							}
						}
					});
				}
		      /*
					 * , handler: function () { if (form.form('validate')) {
					 * $.post("/change/info", form.serialize(), function (rs) {
					 * if (rs.success) { dialog.dialog('close');
					 * location.replace('/zhujiemian'); } else {
					 * $.messager.alert("系统提示", rs.message); } }) }
					 */
		      }]
		  });
		  });
	  
});